package com.nbcio.iot.controller;

import com.nbcio.common.core.domain.R;
import com.nbcio.iot.config.IotModbusPollingProperties;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/iot/modbus/polling")
@RequiredArgsConstructor
public class ModbusPollingAdminController {

    private final IotModbusPollingProperties props;

    @PostMapping("/enable")
    public R<Void> enable() {
        props.setEnabled(true);
        return R.ok();
    }

    @PostMapping("/disable")
    public R<Void> disable() {
        props.setEnabled(false);
        return R.ok();
    }
} 